namespace Radar
{
    using System;

    public abstract class Lifetime
    {
        internal Func<ResolveContext, object> GetBuilder(Func<ResolveContext, object> initialBuild)
        {
            if (initialBuild == null) throw new ArgumentNullException("initialBuild");

            return GetBuilderInternal(initialBuild);
        }

        public static Lifetime Transient { get { return new TransientLifetime(); } }
        public static Lifetime Singleton { get { return new SingletonLifetime(); } }
        public static Lifetime ThreadLocal { get { return new ThreadLocalLifetime(); } }

        protected abstract Func<ResolveContext, object> GetBuilderInternal(Func<ResolveContext, object> initialBuild);
    }
}